﻿/*********************************************************************************/
/**    Sims3Pack Readme Generator                                               **/
/**    Copyright (C) 2012  Anja Knackstedt                                      **/
/**                                                                             **/
/**    This program is free software: you can redistribute it and/or modify     **/
/**    it under the terms of the GNU General Public License as published by     **/
/**    the Free Software Foundation, either version 3 of the License, or        **/
/**    (at your option) any later version.                                      **/
/**                                                                             **/
/**    This program is distributed in the hope that it will be useful,          **/
/**    but WITHOUT ANY WARRANTY; without even the implied warranty of           **/
/**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            **/
/**    GNU General Public License for more details.                             **/
/**                                                                             **/
/**    You should have received a copy of the GNU General Public License        **/
/**    along with this program.  If not, see <http://www.gnu.org/licenses/>.    **/
/**                                                                             **/
/*********************************************************************************/




using Sims3PackReadmeGenerator.Layout;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Resources;
using System.Globalization;
using System.Threading;
using Sims3PackReadmeGenerator;

namespace CreateStandardLayouts
{
    class Program
    {
        static ResourceManager _resManager;

        static void Main(string[] args)
        {
            _resManager = new ResourceManager("CreateStandardLayouts.layoutText", System.Reflection.Assembly.GetExecutingAssembly());
            
            
            StandardLayoutCollection standardDELayoutCollection = new StandardLayoutCollection();
            standardDELayoutCollection.GuiLanguage = Sims3PackReadmeGenerator.Languages.de;
            standardDELayoutCollection.LayoutLanguage = Sims3PackReadmeGenerator.Languages.de;
            standardDELayoutCollection.SaveFileIdCode = "DE";
            standardDELayoutCollection.Name = "standardLayoutDe";
            standardDELayoutCollection.IsChoosenForOutput = true;
            addLayouts(standardDELayoutCollection, "de");
            Serialise(standardDELayoutCollection);

            StandardLayoutCollection standardENLayoutCollection = new StandardLayoutCollection();
            standardENLayoutCollection.GuiLanguage = Sims3PackReadmeGenerator.Languages.de;
            standardENLayoutCollection.LayoutLanguage = Sims3PackReadmeGenerator.Languages.en;
            standardENLayoutCollection.SaveFileIdCode = "EN";
            standardENLayoutCollection.Name = "standardLayoutEn";
            standardDELayoutCollection.IsChoosenForOutput = true;
            addLayouts(standardENLayoutCollection, "en");
            Serialise(standardENLayoutCollection);
            
        }
        private static void Serialise(StandardLayoutCollection layoutCollection)
        {
            Stream SerializeFileStream = File.Create(layoutCollection.Name + ".layout");
            BinaryFormatter serializer = new BinaryFormatter();
            serializer.Serialize(SerializeFileStream, layoutCollection);
            SerializeFileStream.Close();
        }
        private static void addLayouts(StandardLayoutCollection layoutCollection, string lang)
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);

            Layout animalLayout = new Layout(LayoutTypes.animal, _resManager.GetString("layoutAnimal"));
            layoutCollection.AddLayout(animalLayout);
            Layout coatsetLayout = new Layout(LayoutTypes.coatset, _resManager.GetString("layoutCoatset"));
            layoutCollection.AddLayout(coatsetLayout);
            Layout comlotLayout = new Layout(LayoutTypes.comlot, _resManager.GetString("layoutComlot"));
            layoutCollection.AddLayout(comlotLayout);
            Layout commonLayout = new Layout(LayoutTypes.common, _resManager.GetString("layoutCommon"));
            layoutCollection.AddLayout(commonLayout);
            Layout householdLayout = new Layout(LayoutTypes.household, _resManager.GetString("layoutHousehold"));
            layoutCollection.AddLayout(householdLayout);
            Layout patternLayout = new Layout(LayoutTypes.pattern, _resManager.GetString("layoutPattern"));
            layoutCollection.AddLayout(patternLayout);
            Layout presetLayout = new Layout(LayoutTypes.preset, _resManager.GetString("layoutPreset"));
            layoutCollection.AddLayout(presetLayout);
            Layout reslotLayout = new Layout(LayoutTypes.reslot, _resManager.GetString("layoutReslot"));
            layoutCollection.AddLayout(reslotLayout);
            Layout reslotoccLayout = new Layout(LayoutTypes.reslotocc, _resManager.GetString("layoutReslotocc"));
            layoutCollection.AddLayout(reslotoccLayout);
            Layout simLayout = new Layout(LayoutTypes.sim, _resManager.GetString("layoutSim"));
            layoutCollection.AddLayout(simLayout);
            Layout worldLayout = new Layout(LayoutTypes.world, _resManager.GetString("layoutWorld"));
            layoutCollection.AddLayout(worldLayout);
            

        }

        
    }
}
